package Controller;
 

 
import Entity.Customer;
 

 
import java.util.Date;
import Entity.CasualSubscription;
import Entity.DisabledPlace;
 
import Entity.FullSubscription;
 
import Entity.OneTimeCostumerOrder;
 
import Entity.Order;
 
import Entity.ParkingLot;
 
import Entity.ParkingLotManager;
 
import Entity.ParkingLotWorker;
 
import Entity.Prices;
 
import Entity.Subscription;
 
import Entity.Worker;
 
import Entity.Worker.Role;
 
import GUI.FrameIS;
 
import GUI.FrameSystem;
 

 
public class Client {
 
        public Client(){};
 
        static CasualSubscription [] subs=new CasualSubscription[3];
 
        static FullSubscription [] fsubs=new FullSubscription[20];
 
        static Order [] orders=new Order[20]; // demo for the DB.
        static Customer[] customers=new Customer[20]; // also demo for the DB.
 
        static OneTimeCostumerOrder[] otco=new OneTimeCostumerOrder[20];
 
        static ParkingLot[] plots=new ParkingLot[6];
 
        static ParkingLotWorker[] plWorkers=new ParkingLotWorker[1];
 
        
 
        public static void main (String[]args)
 
        {
 
                
 
        }
 
        
 
        public static void testing()
 
        {
        		
        	
        		customers[0]=new Customer("123456789","or","marx","o@walla.com","1234");
        	
                //parking lots
 
                plots[0]=new ParkingLot();
 
                plots[0].setParking_lot_number(0);
 
                plots[0].setParking_lot_name("ramatgan");
 
                plots[0].createParkingLot(3, 3, 4);
 
                
 
                plots[1]=new ParkingLot();
 
                plots[1].setParking_lot_number(1);
 
                plots[1].setParking_lot_name("givataim");
 
                plots[1].createParkingLot(3, 3, 4);
 
                plots[2]=new ParkingLot();
 
                plots[2].setParking_lot_number(2);
 
                plots[2].setParking_lot_name("telaviv");
 
                plots[2].createParkingLot(3, 3, 4);
 
                plots[3]=new ParkingLot();
 
                plots[3].setParking_lot_number(3);
 
                plots[3].setParking_lot_name("natania");
 
                plots[3].createParkingLot(3, 3, 4);
 
                plots[4]=new ParkingLot();
 
                plots[4].setParking_lot_number(4);
 
                plots[4].setParking_lot_name("haifa");
 
                plots[4].createParkingLot(3, 3, 4);
 
                plots[5]=new ParkingLot();
 
                plots[5].setParking_lot_number(5);
 
                plots[5].setParking_lot_name("beersheva");
 
                plots[5].createParkingLot(3, 3, 4);
 
                
 
                Date d=new Date();
 
                /*plots[0].insertCar("1111111", d);
 
                plots[0].insertCar("2222222", d);
 
                plots[0].insertCar("3333333", d);
 
                plots[0].insertCar("4444444", d);
 
                plots[0].insertCar("5555555", d);
 
                plots[0].insertCar("6666666", d);
 
                plots[0].insertCar("7777777", d);
 
                plots[0].insertCar("8888888", d);
 
                plots[0].insertCar("9999999", d);
 
                plots[0].insertCar("1234568", d);
 
                plots[0].insertCar("1234569", d);
 
                plots[0].insertCar("1234560", d);*/
 
                // end parking lots
 
                
 
                
 
                //otco
 
                Date d1[]=new Date[3];
 
                d1[0]=new Date();
 
                d1[1]=new Date();
 
                d1[2]=new Date();
 
                d1[0].setTime(d1[0].getTime()+1000*60*60*7);
 
                d1[1].setTime(d1[1].getTime()+1000*60*60*8);
 
                d1[2].setTime(d1[2].getTime()+1000*60*60*9);
 
                otco[0]=new OneTimeCostumerOrder("203247267", d1[0], "or@walla.com", "1234568");
 
                otco[1]=new OneTimeCostumerOrder("111222333", d1[1], "or1@walla.com", "1234569");
 
                otco[2]=new OneTimeCostumerOrder("333222111", d1[2], "or2@walla.com", "1234560");
 
                Date d2=new Date();
 
                d2.setTime(d2.getTime()-1000*60*60*10);
 
                otco[0].setEntering_hour(d2);
 
                //otco
 
                
 
                
 
                
 
                
 
                //full subs
 
                Date [] dates=new Date[3];
 
                
 
                fsubs[0]=new FullSubscription();
 
                fsubs[0].setCustomer_id("203247267");
 
                fsubs[0].setCar_number("4444444");
 
                dates[0]=new Date();
 
                dates[0].setTime(dates[0].getTime()-1000*60*60*24);
 
                fsubs[0].setStart_date(dates[0]);
 
                dates[0]=(Date) dates[0].clone();
 
                dates[0].setTime(dates[0].getTime()+1000*60*60*48);
 
                fsubs[0].setEnd_date(dates[0]);
 
                fsubs[1]=new FullSubscription();
 
                fsubs[1].setCustomer_id("203247267");
 
                fsubs[1].setCar_number("5555555");
 
                dates[1]=new Date();
 
                dates[1].setTime(dates[1].getTime()-1000*60*60*48);
 
                fsubs[1].setStart_date(dates[1]);
 
                dates[1]=(Date) dates[1].clone();
 
                dates[1].setTime(dates[1].getTime()+1000*60*60*72);
 
                fsubs[1].setEnd_date(dates[1]);
 
                fsubs[2]=new FullSubscription();
 
                fsubs[2].setCustomer_id("203247267");
 
                fsubs[2].setCar_number("6666666");
 
                dates[2]=new Date();
 
                dates[2].setTime(dates[2].getTime()-1000*60*60*72);
 
                fsubs[2].setStart_date(dates[2]);
 
                dates[2]=(Date) dates[2].clone();
 
                dates[2].setTime(dates[2].getTime()+1000*60*60*96);
 
                fsubs[2].setEnd_date(dates[2]);
 
                //full subs
 
        
 
                
 
                
 
                //pl worker
 
                plWorkers[0]=new ParkingLotWorker("203247267","or","marx","or@walla.com","1234",1);
 
                //pl worker end
 
                
 
                
 
                //orders
 
                Date [] dates1=new Date[3];
 
                dates1[0]=new Date();
 
                dates1[0].setTime(dates1[0].getTime()-1000*60);
 
                dates1[1]=new Date();
 
                dates1[1].setTime(dates1[0].getTime()+1000*60*60*48);
 
                dates1[2]=new Date();
 
                dates1[2].setTime(dates1[0].getTime()-1000*60*60*72);
 
                Date [] dates2=new Date[3];
 
                dates2[0]=new Date();
 
                dates2[0].setTime(dates1[0].getTime()+1000*60*60*4);
 
                dates2[1]=new Date();
 
                dates2[1].setTime(dates1[0].getTime()+1000*60*60*51);
 
                dates2[2]=new Date();
 
                dates2[2].setTime(dates1[0].getTime()+1000*60*60*75);
 
                orders[0]=new Order("203247267","7777777",1,dates1[0],dates2[0],"Or_marm@walla.com");
 
                orders[1]=new Order("123123123","8888888",1,dates1[1],dates2[1],"Or_marm@walla.com");
 
                orders[2]=new Order("321321321","9999999",2,dates1[2],dates2[2],"Or_marm@walla.com");
 
                //orders
 
        }
 
        
 
        
 
        
 
        
 
        public static void saveSubscriptionToDB(Object sub)     //save new subscription (should check if its full or not)
 
        {
 
                if (sub instanceof FullSubscription)
 
                {
 
                        int i=0;
 
                        while (fsubs[i]!=null)
 
                                i++;
 
                        fsubs[i]=(FullSubscription) sub;
 
                }
 
        }
 
        public static void UpdateParkingLotToDB(Object pl)      //update change in a parking lot
 
        {
 
                System.out.println("updating parking lot: "+((ParkingLot)pl).getParking_lot_name());
 
        }
 
        public static String getLoggedIn()      //in the system main
 
        {
 
                return "203247267";
 
        }
 
        public static int getParkingLot()       //in the information station main
 
        {
 
                return 1;
 
        }
 
        
 
        public static String getParkingLotNameByNumber(int pNum)        //can use "getParkingLots_sorted()"
 
        {
 
                ParkingLot[] plots=getParkingLots_sorted();
 
                for (int i=0; i<plots.length;i++)
 
                        if (plots[i].getParking_lot_number()==pNum)
 
                                return plots[i].getParking_lot_name();
 
                return null;
 
        }
 
        
 
        public static ParkingLot[] getParkingLots_sorted()      //parking lots are sorted by parking lot number(parking lot i is at [i-1])
 
        {
 
                //ParkingLot[] plots=new ParkingLot[6];
 
                
 
                return plots;
 
        }
 
        
 
        public static FullSubscription  getFullSubscriptionByNumber(int subscription_number) //can use "getFullSubscriptions()"
 
        {
 
                FullSubscription sub=new FullSubscription();
 
                Date startDate=new Date();
 
                Date endDate=new Date();
 
                startDate.setTime(startDate.getTime()-1000*60*60*24*14);
 
                endDate.setTime(endDate.getTime()+1000*60*60*24*14);
 
                sub.setCar_number("1234567");
 
                sub.setCustomer_id("203247267");
 
                sub.setEnd_date(endDate);
 
                sub.setStart_date(startDate);
 
                if(subscription_number==1)
 
                        return sub;
 
                return null;
 
        }
 
        
 
        
 
        public static CasualSubscription  getCasualSubscriptionByNumber(int subscription_number) //can use "getCasualSubscriptions()"
 
        {
 
                CasualSubscription sub=new CasualSubscription();
 
                Date startDate=new Date();
 
                Date endDate=new Date();
 
                startDate.setTime(startDate.getTime()-1000*60*60*24*14);
 
                endDate.setTime(endDate.getTime()+1000*60*60*24*14);
 
                sub.setCar_number("1234567");
 
                sub.setCustomer_id("203247267");
 
                sub.setEnd_date(endDate);
 
                sub.setStart_date(startDate);
 
                sub.setParking_lot_number(1);
 
                sub.setleaving_time(0, 0, 0);
 
                if(subscription_number==2)
 
                        return sub;
 
                return null;
 
        }
 
        
 
        public static Order [] getOrders()
        {
                //Order [] orders=new Order[3];
                int i=0;
                while (orders[i]!=null)
                        i++;
                Order [] orders2=new Order[i];
                for (int j=i-1; j>=0; j--)
                {
                        orders2[j]=orders[j];
                }
                return orders2;
        }
        
        //************new get customer *************
        public static Customer [] getCustomers()
        {
        	int i=0;
        	while(customers[i]!=null)
        		i++;
        	Customer [] customers2=new Customer[i];
        	for(int j=i-1; j>=0; j--)
        	{
        		customers2[j]=customers[j];
        	}
        	return customers2;
        }
        //**************************************
 
        public static FullSubscription [] getFullSubscriptionById(String loggedIn) ////can use "getFullSubscriptions()"
 
        {
 
                //FullSubscription [] fsubs=new FullSubscription[3];
 
                int i=0;
 
                while (fsubs[i]!=null)
 
                        i++;
 
                FullSubscription [] fsubs2=new FullSubscription[i];
 
                for (int j=i-1; j>=0; j--)
 
                {
 
                        fsubs2[j]=fsubs[j];
 
                }
 
                return fsubs2;
 
        }
 
        public static CasualSubscription [] getCasualSubscriptionById(String loggedIn) //can use "getCasualSubscriptions()"
 
        {
 
                //CasualSubscription [] subs=new CasualSubscription[3];
 
                Date [] dates=new Date[3];
 
                
 
                
 
                
 
                subs[0]=new CasualSubscription();
 
                subs[0].setCustomer_id("203247267");
 
                subs[0].setCar_number("1111111");
 
                dates[0]=new Date();
 
                subs[0].setEnd_date(dates[0]);
 
                dates[0]=(Date) dates[0].clone();
 
                dates[0].setTime(dates[0].getTime()-1000*60*60*96);
 
                subs[0].setStart_date(dates[0]);
 
                subs[0].setleaving_time(11,0,0);
 
                subs[0].setParking_lot_number(1);
 
                subs[1]=new CasualSubscription();
 
                subs[1].setCustomer_id("203247267");
 
                subs[1].setCar_number("2222222");
 
                dates[1]=new Date();
 
                subs[1].setEnd_date(dates[1]);
 
                dates[1]=(Date) dates[1].clone();
 
                dates[1].setTime(dates[1].getTime()-1000*60*60*120);
 
                subs[1].setStart_date(dates[1]);
 
                subs[1].setleaving_time(12,0,0);
 
                subs[1].setParking_lot_number(2);
 
                subs[2]=new CasualSubscription();
 
                subs[2].setCustomer_id("203247267");
 
                subs[2].setCar_number("3333333");
 
                dates[2]=new Date();
 
                subs[2].setEnd_date(dates[2]);
 
                dates[2]=(Date) dates[2].clone();
 
                dates[2].setTime(dates[2].getTime()-1000*60*60*144);
 
                subs[2].setStart_date(dates[2]);
 
                subs[2].setleaving_time(1,0,0);
 
                subs[2].setParking_lot_number(3);
 
                return subs;
 
        }
 
        public static void UpdateOrderInDB(Object order) {      //ca use "getOrders()"
 
                System.out.println("updating parking lot: "+((Order)order).getOrderID());
 
                
 
        }
 

 
        public static Prices getCurrentPrices(int parkingLot) {         //get the current used prices record of the parking lot (the prices record with the latest date)
 
                return new Prices(parkingLot);
 
        }
 
        
 
        public static void saveOneTimeCostumerToDB(OneTimeCostumerOrder order) {
 
                int i=0;
 
                while (otco[i]!=null)
 
                        i++;
 
                otco[i]=order;
 
        }
 
        
 
        public static ParkingLotWorker getPlWorkerByID(String id) {
 
                for (int i=0; i<plWorkers.length;i++)
 
                        if(id=="203247267")
 
                                return plWorkers[i];
 
                return null;
 
        }
 
        
 
        public static ParkingLotWorker[] getPlWorkers() {
 
                return plWorkers;
 
        }
 
        
 
        public static void saveDisabledPlaceToDB(DisabledPlace dp) {
 
                System.out.println("Disabled spot saved");
 
        }
 
        public static DisabledPlace getCurrentDisabledParkingSpot(int[] place,int parkingLot) { //return the disabledPlace record with the input details THAT DOESNT HAVE END DATE
 
                DisabledPlace dp=new DisabledPlace(1,place,"sup");                                                                      //if there is no such record return null
 
                dp.setEnd(new Date());
 
                dp.setStart(new Date());
 
                return dp;
 
        }
 
        
 
        public static void updateDisabledSpot(DisabledPlace dp) {
 
                
 
        }
 
        public static Customer[] getCustomers1(){
 
                Customer c=new Customer("203247267","or","marx","or@walla.com","1234");
 
                Customer cc[]=new Customer[1];
 
                cc[0]=c;
 
                return cc;
 
                }
 
        public static void updateCustomer(Customer c) {         //can use "getCostumers()"
 
        	int i=0,save=-1;
            while (customers[i]!=null){
            	if(c.getcustomer_id().equals(customers[i].getcustomer_id())) {
            		save=i;
            		
            	}
            	i++;
            } 
            if(save!=-1)
            	customers[save]=c;
 
        }
 

 
        
 
        public static void updateFullSubscription(FullSubscription fullSubscription) {  //can use "getFullSubscriptions()"
 
System.out.println("updating  "+fullSubscription);              
 
        }
 
        public static void updateCasualSubscription(
 
                        CasualSubscription casualSubscription) {
 
                System.out.println("updating  "+casualSubscription);                    
 
        }
 
        public static FullSubscription[] getFullSubscriptions() {
 
                return getFullSubscriptionById("203247267");
 
        }
 
        public static CasualSubscription[] getCasualSubscriptions() {
 
                return getCasualSubscriptionById("203247267");
 
        }
 
        public static OneTimeCostumerOrder[] getOneTimeCustomerOrders() {
 
                //OneTimeCostumerOrder otco[]=new OneTimeCostumerOrder[3];
 
                int i=0;
 
                while (otco[i]!=null)
 
                        i++;
 
                OneTimeCostumerOrder[] otco2=new OneTimeCostumerOrder[i];
 
                for (int j=i-1; j>=0; j--)
 
                {
 
                        otco2[j]=otco[j];
 
                }
 

 
                return otco2;
 
        }
 
        public static void updateOneTimeCustomerOrder(
 
                        OneTimeCostumerOrder oneTimeCostumerOrder) {
 
                // TODO Auto-generated method stub
 
                
 
        }
 
        public static void saveOrderToDB(Order order) {
                int i=0;
                while (orders[i]!=null)
                        i++;
                orders[i]=order;                
        }
        
        //************ new save customer to DB******
        public static void saveCustomerToDB(Customer customer) {
            int i=0,save=-1;
            while (customers[i]!=null){
            	if(customer.getcustomer_id().equals(customers[i].getcustomer_id())) {
            		save=i;
            		break;
            	}
            	i++;
            } 
            if(save==-1)
            	customers[i]=customer;
            else
            	customers[save]=customer;
        }
         //*********************
        
        public static Customer getCustomerbyID(String id){
            int i=0,save=0;
            while (customers[i]!=null){
            	if(customers[i].getcustomer_id().equals(id)) { //search the client
            		save=i;
            		break;
            	}
            	i++;
            } 
			return customers[save];
        }
 
        /////// OLD STUFF XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
        /*
 
        public static void saveSubscriptionToDB(Object sub)     //save new subscription (should check if its full or not)
 
        {
 
                if(sub instanceof FullSubscription)
 
                        DBcontroller.saveFullSub((FullSubscription)sub);
 
                else
 
                        DBcontroller.saveCasualSub((CasualSubscription)sub);
 
        }
 
        public static void UpdateParkingLotToDB(Object pl)      //update change in a parking lot
 
        {
 
                DBcontroller.saveParkingLot((ParkingLot)pl);
 
        }
 
        public static String getLoggedIn()      //in the system main
 
        {
 
                return FrameSystem.getLoggedIn();
 
        }
 
        public static int getParkingLot()       //in the information station main
 
        {
 
                return FrameIS.getParkingLot();
 
        }
 
        
 
        public static String getParkingLotNameByNumber(int pNum)        //can use "getParkingLots_sorted()"
 
        {
 
                ParkingLot[] plots=getParkingLots_sorted();
 
                for (int i=0; i<plots.length;i++)
 
                        if (plots[i].getParking_lot_number()==pNum)
 
                                return plots[i].getParking_lot_name();
 
                return null;
 
        }
 
        
 
        public static ParkingLot[] getParkingLots_sorted()      //parking lots are sorted by parking lot number(parking lot i is at [i-1])
 
        {
 
                return DBcontroller.getParkingLots_sorted();
 
        }
 
        
 
        public static FullSubscription  getFullSubscriptionByNumber(int subscription_number) //can use "getFullSubscriptions()"
 
        {
 
                FullSubscription[] sub=DBcontroller.getFullSubscriptions();
 
                for(int i=0; i<sub.length; i++)
 
                        if(Integer.valueOf(sub[i].getSubscription_number())==subscription_number)
 
                                return sub[i];
 
                return null;
 
        }
 
        
 
        
 
        public static CasualSubscription  getCasualSubscriptionByNumber(int subscription_number) //can use "getCasualSubscriptions()"
 
        {
 
                CasualSubscription[] sub=DBcontroller.getCasualSubscriptions();
 
                for(int i=0; i<sub.length; i++)
 
                        if(Integer.valueOf(sub[i].getSubscription_number())==subscription_number)
 
                                return sub[i];
 
                return null;
 
        }
 
        
 
        public static Order [] getOrders()
 
        {
 
                return DBcontroller.getOrders();
 
        }
 
        
 
        public static FullSubscription [] getFullSubscriptionById(String loggedIn) ////can use "getFullSubscriptions()"
 
        {
 
                FullSubscription[] sub=DBcontroller.getFullSubscriptions(); int num=0;
 
                for(int i=0; i<sub.length; i++)
 
                        if(sub[i].equals(loggedIn))
 
                                num++;
 
                if(num==0) return null;
 
                FullSubscription[] arr=new FullSubscription[num];
 
                for(int i=0, j=0; i<sub.length; i++)
 
                        if(sub[i].equals(loggedIn))
 
                                {arr[j]=sub[i]; j++;}
 
                return arr;
 
        }
 
        public static CasualSubscription [] getCasualSubscriptionById(String loggedIn) //can use "getCasualSubscriptions()"
 
        {
 
                CasualSubscription[] sub=DBcontroller.getCasualSubscriptions(); int num=0;
 
                for(int i=0; i<sub.length; i++)
 
                        if(sub[i].equals(loggedIn))
 
                                num++;
 
                if(num==0) return null;
 
                CasualSubscription[] arr=new CasualSubscription[num];
 
                for(int i=0, j=0; i<sub.length; i++)
 
                        if(sub[i].equals(loggedIn))
 
                                {arr[j]=sub[i]; j++;}
 
                return arr;
 
        }
 
        public static void UpdateOrderInDB(Object order) {      //ca use "getOrders()"
 
                DBcontroller.deleteOrder((Order) order);
 
                DBcontroller.saveOrder((Order) order);
 
                
 
        }
 

 
        public static Prices getCurrentPrices(int parkingLot) {         //get the current used prices record of the parking lot (the prices record with the latest date)
 
                return DBcontroller.getCurrentPrices(parkingLot);
 
        }
 
        public static void saveOneTimeCostumerToDB(OneTimeCostumerOrder order) {
 
                DBcontroller.saveOneTimeCustomerOrder(order);
 
                
 
        }
 
        public static ParkingLotWorker getPlWorkerByID(String id) {
 
                Worker[] w=DBcontroller.getWorkers();
 
                for(int i=0; i<w.length; i++)
 
                {
 
                        if(id.equals(w[i].getWorkerID()) && w[i].getR()==Role.parkingLotWorker)
 
                        {
 
                                ParkingLotWorker n=new ParkingLotWorker(w[i].getWorkerID(),w[i].getFirstName(),w[i].getLastName(),w[i].getEmail(),w[i].getPassword(),DBcontroller.getParkingLotOfWorker(id));
 
                                return n;
 
                        }
 
                }
 
                return null;
 
                
 
        }
 
        public static void saveDisabledPlaceToDB(DisabledPlace dp) 
 
        {
 
                DBcontroller.saveDisabledPlace(dp);
 
        }
 
        public static DisabledPlace getCurrentDisabledParkingSpot(int[] place,int parkingLot) 
 
        {       //return the disabledPlace record with the input details THAT DOESNT HAVE END DATE
 
                return DBcontroller.getCurrectDisabledParkingSpot(place,parkingLot);
 
        }
 
        
 
        public static void updateDisabledSpot(DisabledPlace dp) 
 
        {
 
                DBcontroller.deleteDisabledPlace(dp);
 
                DBcontroller.saveDisabledPlace(dp);
 
        }
 
        public static Customer[] getCustomers(){
 
                return DBcontroller.getCustomers();
 
                }
 
        public static void updateCustomer(Customer c) {
 
                DBcontroller.deleteCustomer(c);
 
                DBcontroller.saveCustomer(c);
 
        }
 

 
        
 
        public static void updateFullSubscription(FullSubscription fullSubscription) 
 
        {
 
                DBcontroller.deleteFullSub(fullSubscription);
 
                DBcontroller.saveFullSub(fullSubscription);
 
        }
 
        public static void updateCasualSubscription(CasualSubscription casualSubscription) 
 
        {
 
                DBcontroller.deleteCasualSub(casualSubscription);
 
                DBcontroller.saveCasualSub(casualSubscription); 
 
        }
 
        public static FullSubscription[] getFullSubscriptions() {
 
                return DBcontroller.getFullSubscriptions();
 
        }
 
        public static CasualSubscription[] getCasualSubscriptions() {
 
                return DBcontroller.getCasualSubscriptions();
 
        }
 
        public static OneTimeCostumerOrder[] getOneTimeCustomerOrders() 
 
        {
 
                return DBcontroller.getOneTimeCustomerOrder();
 
        }
 
        public static void updateOneTimeCustomerOrder(OneTimeCostumerOrder oneTimeCostumerOrder) 
 
        {
 
                DBcontroller.deleteOneTimeCustomerOrder(oneTimeCostumerOrder);
 
                saveOneTimeCostumerToDB(oneTimeCostumerOrder);
 
        }
 
        public static void saveOrderToDB(Order order) {
 
                DBcontroller.saveOrder(order);
 
                
 
        }
 
        public static ParkingLotManager getPlManagerByID(String id) {
 
                Worker[] w=DBcontroller.getWorkers();
 
                for(int i=0; i<w.length; i++)
 
                {
 
                        if(id.equals(w[i].getWorkerID()) && w[i].getR()==Role.parkingLotManager)
 
                        {
 
                                ParkingLotManager n=new ParkingLotManager(w[i].getWorkerID(),w[i].getFirstName(),w[i].getLastName(),w[i].getEmail(),w[i].getPassword(),DBcontroller.getParkingLotOfWorker(id));
 
                                return n;
 
                        }
 
                }
 
                return null;
 
                
 
        }
 
        */
}
 
